home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
PickMeUp.sit
/
Pick Me Up
/
source code
/
Movie app source
/
pickmeUp97
/
source
/
PP Basic Starter.cp
< prev
next >
Wrap
Text File
|
1997-06-27
|
5KB
|
194 lines
// ===========================================================================
// PP Basic Starter.cp ©1994-1997 Metrowerks Inc. All rights reserved.
// ===========================================================================
//
// This file contains the starter code for a basic PowerPlant application
#include "PP Basic Starter.h"
#include <LGroupBox.h>
#include <LGrowZone.h>
#include <LWindow.h>
#include <PP_Messages.h>
#include <PP_Resources.h>
#include <PPobClasses.h>
#include <UDrawingState.h>
#include <UMemoryMgr.h>
#include <URegistrar.h>
#include <LEditField.h>
#include "CMoviePane.h"
#include "CMovieWind.h"
// put declarations for resource ids (ResIDTs) here
const ResIDT window_Sample = 1; // EXAMPLE
// ===========================================================================
// • Main Program
// ===========================================================================
void main(void)
{
// Set Debugging options
SetDebugThrow_(debugAction_LowLevelDebugger);
SetDebugSignal_(debugAction_LowLevelDebugger);
InitializeHeap(3); // Initialize Memory Manager
// Parameter is number of Master Pointer
// blocks to allocate
// Initialize standard Toolbox managers
UQDGlobals::InitializeToolbox(&qd);
new LGrowZone(20000); // Install a GrowZone function to catch
// low memory situations.
CPPStarterApp theApp; // replace this with your App type
theApp.Run();
}
// ---------------------------------------------------------------------------
// • CPPStarterApp // replace this with your App type
// ---------------------------------------------------------------------------
// Constructor
CPPStarterApp::CPPStarterApp()
{
// Register functions to create core PowerPlant classes
RegisterAllPPClasses();
RegisterClass_(CMoviePane);
RegisterClass_(CMovieWind);
RegisterClass_(LGroupBox);
mWindow = nil;
mFirstTime = true;
}
// ---------------------------------------------------------------------------
// • ~CPPStarterApp // replace this with your App type
// ---------------------------------------------------------------------------
// Destructor
//
CPPStarterApp::~CPPStarterApp()
{
}
// ---------------------------------------------------------------------------
// • StartUp
// ---------------------------------------------------------------------------
// This function lets you do something when the application starts up
// without a document. For example, you could issue your own new command.
void
CPPStarterApp::StartUp()
{
ObeyCommand(cmd_New, nil); // EXAMPLE, create a new window
}
// ---------------------------------------------------------------------------
// • ObeyCommand
// ---------------------------------------------------------------------------
// Respond to commands
Boolean
CPPStarterApp::ObeyCommand(
CommandT inCommand,
void *ioParam)
{
Boolean cmdHandled = true;
switch (inCommand) {
// Deal with command messages (defined in PP_Messages.h).
// Any that you don't handle will be passed to LApplication
case cmd_New:
//Debugger();
mWindow = (CMovieWind*)LWindow::CreateWindow(100, this);
Assert_(mWindow);
mWindow->Show();
//mWindow->Play();
break;
default:
cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
break;
}
return cmdHandled;
}
// ---------------------------------------------------------------------------
// • FindCommandStatus
// ---------------------------------------------------------------------------
// This function enables menu commands.
//
void
CPPStarterApp::FindCommandStatus(
CommandT inCommand,
Boolean &outEnabled,
Boolean &outUsesMark,
Char16 &outMark,
Str255 outName)
{
switch (inCommand) {
// Return menu item status according to command messages.
// Any that you don't handle will be passed to LApplication
case cmd_New: // EXAMPLE
outEnabled = true; // enable the New command
break;
default:
LApplication::FindCommandStatus(inCommand, outEnabled,
outUsesMark, outMark, outName);
break;
}
}
// ---------------------------------------------------------------------------
// • EventResume
// ---------------------------------------------------------------------------
//
//
void
CPPStarterApp::EventResume(const EventRecord& inMacEvent)
{
inherited::EventResume(inMacEvent);
mWindow->Show();
//mWindow->Play();
}
// ---------------------------------------------------------------------------
// • EventActivate
// ---------------------------------------------------------------------------
//
//
void
CPPStarterApp::EventActivate(const EventRecord& inMacEvent)
{
inherited::EventActivate(inMacEvent);
//mWindow->Show();
mWindow->Play();
/*
if(!mFirstTime)
{
mWindow->Play();
}else{
mFirstTime = false;
}
*/
}